<?php defined('DML') or die('Access locked');
   
class Actions{
   private $inclfile;
   
   public function __construct($getmod) {
      switch($getmod){
         case 'addNote':
            $this->inclfile = PATH.DS.'modules'.DS.'modNotes'.DS.'addNote.php';
            $this->checkFileAndInclude($this->inclfile);
            break;
         
         case 'delNote':
            $this->inclfile = PATH.DS.'modules'.DS.'modNotes'.DS.'delNote.php';
            $this->checkFileAndInclude($this->inclfile);
            break;
         
         case 'selectOnDate':
            $this->inclfile = PATH.DS.'modules'.DS.'modContent'.DS.'selectOnDate.php';
            $this->checkFileAndInclude($this->inclfile);
            break;
         
         case 'users':
            $this->inclfile = PATH.DS.'modules'.DS.'modUsers'.DS.'usersList.php';
            $this->checkFileAndInclude($this->inclfile);
            break;
         
         case 'logOut':
            $this->inclfile = PATH.DS.'modules'.DS.'modAuth'.DS.'logout.php';
            $this->checkFileAndInclude($this->inclfile);
            break;
         
         default :
            $this->inclfile = PATH.DS.'modules'.DS.'modContent'.DS.'main.php';
            $this->checkFileAndInclude($this->inclfile);
            break;
      }
   }
   
   private function checkFileAndInclude($file){
      if(!file_exists($file)){
         unset($this->inclfile);
         echo 'Файла: <b>$file</b> не существует!';
      }else{
         include_once $file;
      }
   }
}
?>
